
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>1.7.2 社区版服务端 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../1.7.3 使用Web版SDK/" />
    
    
    <link rel="prev" href="../1.7.1 客户端核心SDK/" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../1.1 产品介绍/">
            
                <a href="../../1.1 产品介绍/">
            
                    
                    1.1 产品介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../../1.1 产品介绍/1.1.1 商用社交版/">
            
                <a href="../../1.1 产品介绍/1.1.1 商用社交版/">
            
                    
                    1.1.1 商用社交版
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../../1.1 产品介绍/1.1.2 商用客服版/">
            
                <a href="../../1.1 产品介绍/1.1.2 商用客服版/">
            
                    
                    1.1.2 商用客服版
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../../1.1 产品介绍/1.1.3 社交版开发指南/">
            
                <a href="../../1.1 产品介绍/1.1.3 社交版开发指南/">
            
                    
                    1.1.3 社交版开发指南
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../../1.2 试用与部署/">
            
                <a href="../../1.2 试用与部署/">
            
                    
                    1.2 试用与部署
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../../1.2 试用与部署/1.2.1 社区版编译部署/">
            
                <a href="../../1.2 试用与部署/1.2.1 社区版编译部署/">
            
                    
                    1.2.1 社区版编译部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../../1.2 试用与部署/1.2.2 社区版镜像部署/">
            
                <a href="../../1.2 试用与部署/1.2.2 社区版镜像部署/">
            
                    
                    1.2.2 社区版镜像部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../../1.2 试用与部署/1.2.3 专业版镜像部署/">
            
                <a href="../../1.2 试用与部署/1.2.3 专业版镜像部署/">
            
                    
                    1.2.3 专业版镜像部署
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../../1.3 编译工程/">
            
                <a href="../../1.3 编译工程/">
            
                    
                    1.3 编译工程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../../1.3 编译工程/1.3.1 编译社区版后端源码/">
            
                <a href="../../1.3 编译工程/1.3.1 编译社区版后端源码/">
            
                    
                    1.3.1 编译社区版后端源码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../../1.3 编译工程/1.3.2 编译Web客户端源码/">
            
                <a href="../../1.3 编译工程/1.3.2 编译Web客户端源码/">
            
                    
                    1.3.2 编译Web客户端源码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../../1.3 编译工程/1.3.3 编译移动客户端源码/">
            
                <a href="../../1.3 编译工程/1.3.3 编译移动客户端源码/">
            
                    
                    1.3.3 编译移动客户端源码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../../1.3 编译工程/1.3.4 编译微信小程序源码/">
            
                <a href="../../1.3 编译工程/1.3.4 编译微信小程序源码/">
            
                    
                    1.3.4 编译微信小程序源码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../../1.3 编译工程/1.3.5 编译E聊SDK源码/">
            
                <a href="../../1.3 编译工程/1.3.5 编译E聊SDK源码/">
            
                    
                    1.3.5 编译E聊SDK源码
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../../1.4 系统架构/">
            
                <a href="../../1.4 系统架构/">
            
                    
                    1.4 系统架构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../../1.5 基础知识/">
            
                <a href="../../1.5 基础知识/">
            
                    
                    1.5 基础知识
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../../1.5 基础知识/1.5.1 软件特性/">
            
                <a href="../../1.5 基础知识/1.5.1 软件特性/">
            
                    
                    1.5.1 软件特性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../../1.5 基础知识/1.5.2 客户端核心SDK功能/">
            
                <a href="../../1.5 基础知识/1.5.2 客户端核心SDK功能/">
            
                    
                    1.5.2 客户端核心SDK功能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../../1.5 基础知识/1.5.3 用户/">
            
                <a href="../../1.5 基础知识/1.5.3 用户/">
            
                    
                    1.5.3 用户
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../../1.5 基础知识/1.5.4 连接/">
            
                <a href="../../1.5 基础知识/1.5.4 连接/">
            
                    
                    1.5.4 连接
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../../1.5 基础知识/1.5.5 会话/">
            
                <a href="../../1.5 基础知识/1.5.5 会话/">
            
                    
                    1.5.5 会话
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../../1.5 基础知识/1.5.6 消息/">
            
                <a href="../../1.5 基础知识/1.5.6 消息/">
            
                    
                    1.5.6 消息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../../1.5 基础知识/1.5.7 消息载体/">
            
                <a href="../../1.5 基础知识/1.5.7 消息载体/">
            
                    
                    1.5.7 消息载体
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="../../1.5 基础知识/1.5.8 文件上传功能/">
            
                <a href="../../1.5 基础知识/1.5.8 文件上传功能/">
            
                    
                    1.5.8 文件上传功能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="../../1.5 基础知识/1.5.9 离线消息/">
            
                <a href="../../1.5 基础知识/1.5.9 离线消息/">
            
                    
                    1.5.9 离线消息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10" data-path="../../1.5 基础知识/1.5.10 群组/">
            
                <a href="../../1.5 基础知识/1.5.10 群组/">
            
                    
                    1.5.10 群组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11" data-path="../../1.5 基础知识/1.5.11 自定义消息/">
            
                <a href="../../1.5 基础知识/1.5.11 自定义消息/">
            
                    
                    1.5.11 自定义消息
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../../1.6 服务端知识/">
            
                <a href="../../1.6 服务端知识/">
            
                    
                    1.6 服务端知识
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../../1.6 服务端知识/1.6.1 服务器端口说明/">
            
                <a href="../../1.6 服务端知识/1.6.1 服务器端口说明/">
            
                    
                    1.6.1 服务器端口说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../../1.6 服务端知识/1.6.2 数据库配置/">
            
                <a href="../../1.6 服务端知识/1.6.2 数据库配置/">
            
                    
                    1.6.2 数据库配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../../1.6 服务端知识/1.6.3 机器内存的选择/">
            
                <a href="../../1.6 服务端知识/1.6.3 机器内存的选择/">
            
                    
                    1.6.3 机器内存的选择
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../../1.6 服务端知识/1.6.4 性能测试/">
            
                <a href="../../1.6 服务端知识/1.6.4 性能测试/">
            
                    
                    1.6.4 性能测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../../1.6 服务端知识/1.6.5 服务器配置/">
            
                <a href="../../1.6 服务端知识/1.6.5 服务器配置/">
            
                    
                    1.6.5 服务器配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../../1.6 服务端知识/1.6.6 Server API/">
            
                <a href="../../1.6 服务端知识/1.6.6 Server API/">
            
                    
                    1.6.6 Server API
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../">
            
                <a href="../">
            
                    
                    1.7 源码导读
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../1.7.1 客户端核心SDK/">
            
                <a href="../1.7.1 客户端核心SDK/">
            
                    
                    1.7.1 客户端核心SDK
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.8.2" data-path="./">
            
                <a href="./">
            
                    
                    1.7.2 社区版服务端
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../1.7.3 使用Web版SDK/">
            
                <a href="../1.7.3 使用Web版SDK/">
            
                    
                    1.7.3 使用Web版SDK
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../../1.10 code错误码/">
            
                <a href="../../1.10 code错误码/">
            
                    
                    1.10 code错误码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../../1.11 技术支持/">
            
                <a href="../../1.11 技术支持/">
            
                    
                    1.11 技术支持
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../../1.12 管理后台/">
            
                <a href="../../1.12 管理后台/">
            
                    
                    1.12 管理后台
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../../1.13 常见问题/">
            
                <a href="../../1.13 常见问题/">
            
                    
                    1.13 常见问题
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >1.7.2 社区版服务端</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="172-&#x793E;&#x533A;&#x7248;&#x670D;&#x52A1;&#x7AEF;">1.7.2 &#x793E;&#x533A;&#x7248;&#x670D;&#x52A1;&#x7AEF;</h1>
<p>&#x8FD9;&#x91CC;&#x4EE5;&#x793E;&#x533A;&#x7248;&#x670D;&#x52A1;&#x7AEF;&#x6E90;&#x7801;(&#x7248;&#x672C;v1.10)&#x4E3A;&#x4F8B;&#xFF0C;&#x7406;&#x89E3;&#x670D;&#x52A1;&#x7AEF;SDK&#x7684;&#x8BBE;&#x8BA1;&#x3002;&#x540E;&#x7AEF;&#x4F7F;&#x7528;springboot+mybatis&#x5F00;&#x53D1;&#xFF0C;&#x4F9D;&#x8D56;echatim-server-broker-community &#x4E2D;&#x95F4;&#x4EF6;&#x3002;</p>
<h3 id="1&#x6E90;&#x7801;&#x67B6;&#x6784;">1.&#x6E90;&#x7801;&#x67B6;&#x6784;</h3>
<pre><code class="lang-bash">`-- com
    |-- annotation
    |   |-- MethodFor.java <span class="hljs-comment"># socket.io api&#x6CE8;&#x89E3;Method</span>
    |   |-- Permission.java
    |   `-- TopicFor.java <span class="hljs-comment"># socket.io api&#x6CE8;&#x89E3;Topic</span>
    |-- commom
    |   |-- AppRespError.java <span class="hljs-comment"># &#x793E;&#x533A;&#x7248;&#x540E;&#x7AEF;&#x9519;&#x8BEF;&#x7801;&#x5B9A;&#x4E49;</span>
    |   |-- ConcurrentLimitedQueue.java
    |   |-- Config.java <span class="hljs-comment"># springboot&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x83B7;&#x53D6;&#x5DE5;&#x5177;&#x7C7B;</span>
    |   |-- DBConst.java <span class="hljs-comment"># &#x4E1A;&#x52A1;&#x5E38;&#x91CF;&#x5B9A;&#x4E49;</span>
    |   |-- DBEnum.java
    |   |-- LocalFileRespError.java <span class="hljs-comment"># &#x793E;&#x533A;&#x7248;&#x6587;&#x4EF6;&#x670D;&#x52A1;&#x5668;&#x9519;&#x8BEF;&#x7801;&#x5B9A;&#x4E49;</span>
    |   |-- LocalFileRoute.java
    |   |-- NumberGenerator.java
    |   |-- PermissionConst.java
    |   `-- Topic.java <span class="hljs-comment"># &#x793E;&#x533A;&#x7248;Topic&#x7684;&#x5B9A;&#x4E49;, api&#x89C4;&#x7EA6;&#x5B9A;&#x4E49;</span>
    |-- echatim
    |   |-- ApplicationWrapper.java
    |   |-- CommonMapper.java
    |   |-- broker
    |   |   |-- AppBrokerHook.java
    |   |   |-- BrokerConfig.java
    |   |   |-- SocketIOBroker.java <span class="hljs-comment"># socket.io&#x670D;&#x52A1;&#x542F;&#x52A8;&#xFF0C;Topic&#x7ED1;&#x5B9A;&#xFF0C;&#x6D88;&#x606F;&#x6536;&#x53D1;</span>
    |   |   |-- localsvc
    |   |   |   |-- ITopicSender.java
    |   |   |   |-- TopicDispatcher.java <span class="hljs-comment"># &#x5904;&#x7406;socket.io&#x63A5;&#x53D7;&#x5230;&#x7684;&#x6D88;&#x606F;&#xFF0C;&#x8F6C;&#x53D1;&#x5230;Service</span>
    |   |   |   `-- TopicSender.java <span class="hljs-comment"># &#x628A;&#x6D88;&#x606F;&#x901A;&#x8FC7;socket.io&#x53D1;&#x9001;&#x51FA;&#x53BB;</span>
    |   |   `-- storage
    |   |       |-- AppStorageEntry.java
    |   |       `-- event
    |   |           |-- ClientDisconnectMessage.java
    |   |           |-- ClientOnlineEvent.java
    |   |           `-- LoginEventMessage.java
    |   |-- config
    |   |   |-- EventBusConfig.java
    |   |   |-- FileDownloadConfig.java
    |   |   |-- MybatisPlusConfig.java
    |   |   |-- SocketIOConfig.java
    |   |   |-- Swagger2Config.java
    |   |   |-- TopicFilterConfig.java
    |   |   `-- ValidateConfig.java
    |   |-- controller <span class="hljs-comment"># http api&#x5B9A;&#x4E49;</span>
    |   |   |-- ClientController.java
    |   |   |-- HistoryMessageController.java
    |   |   |-- LoginController.java
    |   |   |-- MessageController.java
    |   |   |-- RoomController.java
    |   |   |-- UserController.java
    |   |   |-- UserRelationController.java
    |   |   `-- fileserver <span class="hljs-comment"># fileserver http api&#x5B9A;&#x4E49;</span>
    |   |       |-- FileApi.java
    |   |       |-- FileConfigDTO.java
    |   |       |-- FileServerController.java
    |   |       |-- FileSignatureCache.java
    |   |       |-- FileUploadCacheDTO.java
    |   |       |-- FileUploadCallbackForm.java
    |   |       |-- FileUploadRequestDTO.java
    |   |       `-- FileUploadRequestForm.java
    |   |-- dto
            ... &#x6A21;&#x578B;&#x6570;&#x636E; ... 
    |   |-- entity
            ... &#x6A21;&#x578B;&#x6570;&#x636E; ... 
    |   |-- filter
    |   |   |-- HttpTopicInterceptor.java
    |   |   |-- ProtocolHandlerInterceptor.java
    |   |   `-- TopicInterceptor.java
    |   |-- form
            ... &#x6A21;&#x578B;&#x6570;&#x636E; ... 
    |   |-- helper
    |   |   `-- PageHelper.java
    |   |-- mapper
    |   |   |-- FileInfoMapper.java
    |   |   |-- MessageMapper.java
    |   |   |-- MessageStableOfflineMapper.java
    |   |   |-- RoomMapper.java
    |   |   |-- RoomUserMapper.java
    |   |   |-- SdkAppMapper.java
    |   |   |-- SdkUserMapper.java
    |   |   |-- UserMapper.java
    |   |   `-- UserRelationMapper.java
    |   `-- service <span class="hljs-comment"># &#x4E1A;&#x52A1;&#x903B;&#x8F91;&#x5B9E;&#x73B0;</span>
    |       `-- app
    |           |-- BaseService.java
    |           |-- HistoryMessageService.java
    |           |-- LoginService.java
    |           |-- MessageService.java
    |           |-- MessageStableOfflineService.java
    |           |-- RoomService.java
    |           |-- RoomUserService.java
    |           |-- SdkAppService.java
    |           |-- SdkUserService.java
    |           |-- UserRelationService.java
    |           |-- UserService.java
    |           `-- fileserver
    |               `-- FileInfoService.java
    |-- event
    |   |-- AppStartup.java
    |   `-- EventBus.java
    |-- exception <span class="hljs-comment"># &#x4E00;&#x4E9B;&#x5168;&#x5C40;&#x5F02;&#x5E38;, &#x82E5;&#x8868;&#x5355;&#x6821;&#x9A8C;&#xFF0C;&#x4E1A;&#x52A1;&#x5F02;&#x5E38;&#x7B49;</span>
    |   |-- FormValidationException.java
    |   |-- HttpGlobalExceptionAdvice.java
    |   |-- ServiceException.java
    |   `-- SocketGlobalExceptionAdvice.java
    `-- utils
        |-- Beans.java
        |-- Pair.java
        |-- ProtocolAnnotationUtils.java
        |-- Streams.java
        |-- Triple.java
        |-- UUIDUtils.java
        `-- mapper
            |-- IDMapper.java
            |-- KeyMapper.java
            `-- Mapper.java
</code></pre>
<h3 id="2echatim-server-broker-community-&#x4E2D;&#x95F4;&#x4EF6;&#x7684;&#x529F;&#x80FD;">2.echatim-server-broker-community &#x4E2D;&#x95F4;&#x4EF6;&#x7684;&#x529F;&#x80FD;</h3>
<blockquote>
<ol>
<li><strong>&#x8F6C;&#x53D1;&#x4E2D;&#x95F4;&#x4EF6;</strong>: &#x8DEF;&#x7531;&#x8F6C;&#x53D1;&#x6D88;&#x606F;&#x5230;socket.io&#x7528;&#x6237;&#x6240;&#x5728;&#x7684;&#x673A;&#x5668;(&#x5355;&#x673A;, &#x673A;&#x5668;&#x4E24;&#x79CD;&#x60C5;&#x51B5;&#x7684;&#x4E0D;&#x540C;&#x5904;&#x7406;)</li>
<li><strong>&#x5B58;&#x50A8;&#x4E2D;&#x95F4;&#x4EF6;</strong>: &#x62BD;&#x8C61;&#x5316;sdk&#x7528;&#x5230;&#x7684;&#x5B58;&#x50A8;&#x63D2;&#x4EF6;(guava, redis&#x7B49;)</li>
<li><strong>&#x6D88;&#x606F;&#x4E2D;&#x95F4;&#x4EF6;</strong>: &#x62BD;&#x8C61;&#x5316;sdk&#x7528;&#x5230;&#x7684;&#x6D88;&#x606F;&#x63D2;&#x4EF6;(eventBus, kafka&#x7B49;)</li>
<li>&#x4E00;&#x4E9B;&#x5E38;&#x7528;&#x7684;&#x5DE5;&#x5177;&#x7C7B;</li>
</ol>
</blockquote>
<h3 id="3&#x63A5;&#x6536;&#x6D88;&#x606F;-&#x5B9A;&#x4E49;http-api&#x4E0E;socketio-api&#x7EDF;&#x4E00;&#x7684;&#x89C4;&#x8303;&#x7EA6;&#x5B9A;">3.&#x63A5;&#x6536;&#x6D88;&#x606F;, &#x5B9A;&#x4E49;http api&#x4E0E;socket.io api&#x7EDF;&#x4E00;&#x7684;&#x89C4;&#x8303;&#x7EA6;&#x5B9A;</h3>
<p>&#x524D;&#x7AEF;&#x4E0E;&#x540E;&#x7AEF;&#x4F7F;&#x7528;http api, socket.io api &#x4E24;&#x79CD;&#x901A;&#x8BAF;&#xFF0C;&#x4E3A;&#x7EDF;&#x4E00;&#x4E24;&#x79CD;api&#xFF0C;&#x5B9A;&#x4E49;&#x4E86;TOPIC, METHOD &#x4E24;&#x4E2A;&#x6982;&#x5FF5;&#x6765;&#x7EA6;&#x5B9A;&#x3002;</p>
<blockquote>
<p><strong>TOPIC</strong>: &#x8BDD;&#x9898;&#xFF0C; &#x53EF;&#x4EE5;&#x7406;&#x89E3;&#x6210;&#x4E00;&#x4E2A;&#x4E1A;&#x52A1;&#x6A21;&#x5757;</p>
<p><strong>METHOD</strong>: TOPIC&#x4E0B;&#x6709;&#x591A;&#x4E2A;METHOD, &#x4E00;&#x4E2A;METHOD&#x5BF9;&#x5E94;&#x540E;&#x7AEF;&#x7684;&#x4E00;&#x4E2A;&#x4E1A;&#x52A1;&#x65B9;&#x6CD5;&#x3002;</p>
</blockquote>
<p><strong>&#x5BF9;&#x4E8E;socket.io api:</strong> &#x540E;&#x7AEF;&#x662F;&#x901A;&#x8FC7;TOPIC, METHOD&#x4E24;&#x4E2A;&#x5173;&#x952E;&#x5B57;&#x6765;&#x5B9A;&#x4F4D;&#x5230;&#x662F;&#x4F7F;&#x7528;&#x54EA;&#x4E2A;&#x4E1A;&#x52A1;&#x65B9;&#x6CD5;&#x6765;&#x5904;&#x7406;&#x8FD9;&#x4E2A;api&#x7684;&#x3002;&#x5982;&#x4EE5;&#x4E0B;&#x7684;&#x767B;&#x5F55;&#x8BA4;&#x8BC1;socket.io api &#x5B9A;&#x4E49;&#x3002;</p>
<pre><code class="lang-java"><span class="hljs-meta">@TopicFor</span>(value = Topic.CONNECTION.name) <span class="hljs-comment">// &#x5B9A;&#x4E49;&#x8BE5;&#x4E1A;&#x52A1;&#x6A21;&#x5757;&#x7684;TOPIC:CONNECTION</span>
<span class="hljs-meta">@Service</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">LoginService</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ServiceImpl</span>&lt;<span class="hljs-title">UserMapper</span>, <span class="hljs-title">User</span>&gt; </span>{
    ... &#x7565; ...
    <span class="hljs-meta">@MethodFor</span>(value = Topic.CONNECTION.METHOD.AUTHORITY_REQUEST, consumer = UserLoginForm.class) <span class="hljs-comment">// &#x7ED1;&#x5B9A;&#x8BE5;&#x4E1A;&#x52A1;&#x65B9;&#x6CD5;&#x5904;&#x7406;&#x5BF9;&#x4E8E;&#x7684;METHOD:AUTHORITY_REQUEST</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> Resp&lt;String&gt; <span class="hljs-title">authority</span><span class="hljs-params">(@Valid UserLoginForm userLoginForm)</span></span>{   
    }
    ... &#x7565; ...
}
</code></pre>
<p>&#x540E;&#x7AEF;&#x4ECE;socket.io&#x63A5;&#x53D7;&#x5230;&#x7684;&#x5BA2;&#x6237;&#x7AEF;&#x6D88;&#x606F;&#x4E2D;&#xFF0C;&#x80FD;&#x83B7;&#x53D6;&#x5230;Topic, Method&#x4E24;&#x4E2A;&#x53D8;&#x91CF;&#x5B9A;&#x4E49;&#xFF0C;&#x7136;&#x540E;&#x901A;&#x8FC7; @TopicFor, @MethodFor &#x4E24;&#x4E2A;&#x6CE8;&#x89E3;&#xFF0C;&#x627E;&#x5230;&#x5BF9;&#x5E94;&#x7684;&#x5339;&#x914D;&#x7684;&#x4E1A;&#x52A1;&#x5904;&#x7406;&#x65B9;&#x6CD5;&#xFF0C;&#x8FD9;&#x4E00;&#x8FC7;&#x7A0B;&#x662F;TopicDispatcher&#x4E2D;&#x5904;&#x7406;&#x7684;&#x3002;</p>
<p><strong>&#x5BF9;&#x4E8E;http api:</strong>  &#x540E;&#x7AEF;&#x4E5F;&#x662F;&#x901A;&#x8FC7;TOPIC, METHOD&#x4E24;&#x4E2A;&#x5173;&#x952E;&#x5B57;&#x6765;&#x5B9A;&#x4F4D;&#x5230;&#x662F;&#x4F7F;&#x7528;&#x54EA;&#x4E2A;Controller method&#x6765;&#x5904;&#x7406;&#x8FD9;&#x4E2A;api&#x7684;&#x3002;</p>
<pre><code class="lang-java"><span class="hljs-meta">@RestController</span>
<span class="hljs-meta">@RequestMapping</span>(Topic.CONNECTION.base_uri)
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">LoginController</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ApiController</span> </span>{
    <span class="hljs-meta">@ApiOperation</span>(value = <span class="hljs-string">&quot;IM&#x7528;&#x6237;&#x767B;&#x5F55;-&#x767B;&#x5F55;&quot;</span>)
    <span class="hljs-meta">@PostMapping</span>(<span class="hljs-string">&quot;/&quot;</span>+Topic.CONNECTION.METHOD.AUTHORITY_REQUEST)
    <span class="hljs-function"><span class="hljs-keyword">public</span> Resp&lt;String&gt; <span class="hljs-title">sdkLogin</span><span class="hljs-params">(@RequestBody @Valid UserLoginForm userLoginForm)</span> </span>{
    }
}
</code></pre>
<p>&#x540E;&#x7AEF;&#x901A;&#x8FC7;&#x62FC;&#x63A5;&#x7684;Topic.CONNECTION.base_uri + &quot;/&quot; + AUTHORITY_REQUEST &#x80FD;&#x5B9A;&#x4F4D;&#x5230;&#x5BF9;&#x5E94;&#x7684;Controller method.</p>
<p>&#x901A;&#x8FC7;&#x8FD9;&#x6837;&#x7684;&#x7EA6;&#x5B9A;&#x4E0E;&#x5B9A;&#x4E49;&#xFF0C;&#x53EF;&#x4EE5;&#x6700;&#x5927;&#x5316;&#x590D;&#x7528;&#x540E;&#x7AEF;&#x7684;Service &#x4E1A;&#x52A1;&#x4EE3;&#x7801;&#x3002;</p>
<h3 id="4socketio&#x63A5;&#x53D7;&#x4E0E;&#x53D1;&#x9001;">4.socket.io&#x63A5;&#x53D7;&#x4E0E;&#x53D1;&#x9001;</h3>
<p>socket.io&#x7684;&#x63A5;&#x53D7;&#x4E0E;&#x53D1;&#x9001;&#x4E3B;&#x8981;&#x5728;SocketIOBroker, TopicDispatcher, TopicSender &#x4E09;&#x4E2A;&#x7C7B;&#x4E2D;&#x5904;&#x7406;&#x3002;</p>
<blockquote>
<p><strong>SocketIOBroker</strong>: 1. &#x8D1F;&#x8D23;socket.io &#x534F;&#x8BAE;&#x670D;&#x52A1;&#x5728;springboot&#x7684;&#x73AF;&#x5883;&#x4E0B;&#x542F;&#x52A8;&#xFF0C;&#x9500;&#x6BC1;;  2. &#x7ED1;&#x5B9A;socket.io &#x8981;&#x76D1;&#x542C;&#x7684;&#x6240;&#x6709;Topic&#x5B9A;&#x4E49;; 3. &#x542F;&#x52A8;&#x5BF9;&#x5E94;&#x7684;&#x4E2D;&#x95F4;&#x4EF6;(&#x5B58;&#x50A8;, &#x4E8B;&#x4EF6;, &#x8F6C;&#x53D1;&#x6A21;&#x5757;&#x7B49;)</p>
<p><strong>TopicDispatcher</strong>: &#x5904;&#x7406;&#x6D88;&#x606F;&#x8F93;&#x5165;, &#x5C06;&#x8F93;&#x5165;&#x7684;&#x6D88;&#x606F;&#x8F6C;&#x53D1;&#x5230;&#x5BF9;&#x5E94;Service&#x4E2D;&#x7684;method &#x4E2D;&#x5904;&#x7406;&#xFF0C;&#x5E76;&#x8FD4;&#x56DE;&#x5904;&#x7406;&#x7ED3;&#x679C;&#x3002;</p>
<p><strong>TopicSender</strong>: &#x7ED9;&#x5B9A;socket.io &#x7684;clientId, &#x5411;&#x8BE5;client&#x53D1;&#x9001;&#x6D88;&#x606F;&#x3002;&#x4E1A;&#x52A1;&#x5E76;&#x4E0D;&#x4F1A;&#x76F4;&#x63A5;&#x8C03;&#x7528;TopicSender &#x53D1;&#x6D88;&#x606F;&#xFF0C;&#x800C;&#x662F;&#x4EA4;&#x7ED9;&#x8F6C;&#x53D1;&#x4E2D;&#x95F4;&#x4EF6;&#x6765;&#x5904;&#x7406;&#x3002;</p>
</blockquote>
<h3 id="5&#x53D1;&#x9001;&#x5373;&#x65F6;&#x6D88;&#x606F;&#x7684;&#x6D41;&#x7A0B;">5.&#x53D1;&#x9001;&#x5373;&#x65F6;&#x6D88;&#x606F;&#x7684;&#x6D41;&#x7A0B;</h3>
<p>&#x53D1;&#x9001;&#x4E00;&#x4E2A;&#x5373;&#x65F6;&#x6D88;&#x606F;&#x7684;&#x6D41;&#x7A0B;&#x5982;&#x4E0B;:
&#x5BA2;&#x6237;&#x7AEF;&#x8C03;&#x7528;&#x53D1;&#x6D88;&#x606F;&#x7684;API(sendMessage) -&gt; &#x540E;&#x7AEF;&#x4FDD;&#x5B58;&#x6D88;&#x606F;&#x5230;&#x6570;&#x636E;&#x5E93;&#xFF0C;&#x5E76;&#x521B;&#x5EFA;ClusterDispatcherEvent&#x5BF9;&#x8C61;&#xFF0C;&#x53D1;&#x9001;ClusterDispatcherEvent&#x5BF9;&#x8C61;&#x5230;&#x8F6C;&#x53D1;&#x4E2D;&#x95F4;&#x4EF6;-&gt; &#x8F6C;&#x53D1;&#x4E2D;&#x95F4;&#x4EF6;&#x67E5;&#x627E;socket.io client &#x6240;&#x5728;&#x7684;&#x673A;&#x5668;&#xFF0C;&#x5F80;&#x8BE5;&#x673A;&#x5668;&#x53D1;&#x9001;&#x6D88;&#x606F;&#x961F;&#x5217;&#x6D88;&#x606F; -&gt;  socket.io client &#x6240;&#x5728;&#x673A;&#x5668;&#x53D1;&#x6D88;&#x606F;&#x7ED9;&#x5BA2;&#x6237;&#x7AEF;</p>
<p>&#x5BF9;&#x4E8E;&#x5355;&#x53F0;&#x673A;&#x5668;&#x7684;&#x60C5;&#x51B5;&#xFF0C;&#x6240;&#x6709;&#x7684;socket.io &#x5BA2;&#x6237;&#x7AEF;&#x90FD;&#x8FDE;&#x63A5;&#x5230;&#x540C;&#x4E00;&#x53F0;&#x673A;&#x5668;&#xFF0C;&#x56E0;&#x6B64;&#x6D41;&#x7A0B;&#x53EF;&#x4EE5;&#x7B80;&#x5316;&#xFF0C;&#x76F4;&#x63A5;&#x5728;&#x5F53;&#x524D;&#x673A;&#x5668;&#x4E0A;&#x67E5;&#x627E;clientId&#x4E0E;&#x767B;&#x5F55;&#x7528;&#x6237;&#x8D26;&#x53F7;&#x7684;&#x6620;&#x5C04;&#x5173;&#x7CFB;&#xFF0C;&#x628A;&#x6D88;&#x606F;&#x8F6C;&#x53D1;&#x5230;&#x8BE5;&#x7528;&#x6237;&#x5373;&#x53EF;&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../1.7.1 客户端核心SDK/" class="navigation navigation-prev " aria-label="Previous page: 1.7.1 客户端核心SDK">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../1.7.3 使用Web版SDK/" class="navigation navigation-next " aria-label="Next page: 1.7.3 使用Web版SDK">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"1.7.2 社区版服务端","level":"1.8.2","depth":2,"next":{"title":"1.7.3 使用Web版SDK","level":"1.8.3","depth":2,"path":"1.7 源码导读/1.7.3 使用Web版SDK/README.md","ref":"1.7 源码导读/1.7.3 使用Web版SDK/README.md","articles":[]},"previous":{"title":"1.7.1 客户端核心SDK","level":"1.8.1","depth":2,"path":"1.7 源码导读/1.7.1 客户端核心SDK/README.md","ref":"1.7 源码导读/1.7.1 客户端核心SDK/README.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"1.7 源码导读/1.7.2 社区版服务端/README.md","mtime":"2021-08-04T03:46:07.707Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-11-19T07:54:02.646Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

